﻿@foreach (var item in Model) {
    <div class="item">
        <a href="@((item.activity_ex != null && item.activity_ex.is_sold_out == false
                    && (item.activity_ex.begin_time <= DateTime.Now || (item.activity_ex.preheat_time != null && item.activity_ex.preheat_time <= DateTime.Now)) && item.activity_ex.end_time >= DateTime.Now)
                            ? "/DistributionMall/ProductDetail?productId=" + item.id :"javascript:void(0)")">

            <div class="itemBox relative">
                <div class="ji-1 absolute"></div>
                <div class="ji-2 absolute"></div>
                <div class="img mb10">
                    <img src="@item.main_image_url">
                </div>
                <div class="text">
                    <div class="tit fn-nowrap2 fn26 mb10">@item.name</div>
                    <div class="pri">
                        <em class="fn24 col-gray2">特惠价￥</em>
                        <em class="fn40 col-red">@(item.price.ToString("f2"))</em>
                    </div>
                    <div class="btnBox">
                        @if (item.activity_ex != null && item.activity_ex.begin_time <= DateTime.Now && item.activity_ex.end_time >= DateTime.Now) {
                            if (item.activity_ex.is_sold_out == false) {
                                <span class="btn fn30">立即购买</span>
                            } else {
                                <span class="btn fn30 cancel">已售罄</span>
                            }
                        } else if (item.activity_ex != null && item.activity_ex.end_time > DateTime.Now && item.activity_ex.begin_time > DateTime.Now) {
                            <span class="btn fn30 cancel">即将开始</span>

                        } else {
                            <span class="btn fn30 cancel">已结束</span>
                        }
                    </div>
                </div>
            </div>
        </a>
    </div>
}